Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table bugs #417

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Fix table bugs #417

wants to merge 15 commits into from

Conversation

alnasir7
Copy link
Contributor

  • Switched function of arrows
  • Default value of "none" for undefined fields
  • bug fixes
  • added sort icons

@codecov
Copy link

codecov bot commented Feb 21, 2021

Codecov Report

Merging #417 (a441681) into master (2844bb7) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #417   +/-   ##
=======================================
  Coverage   72.40%   72.40%           
=======================================
  Files          30       30           
  Lines        5886     5886           
=======================================
  Hits         4262     4262           
  Misses       1624     1624           
Flag Coverage Δ
backend 72.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2844bb7...a441681. Read the comment docs.

Copy link
Member

@ezwang ezwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. When the table is empty, you render nothing. You should still render the table column headers in this case, and have a td with full colspan that informs the user that the table is empty. This will avoid confusion on the user's part.

image

  1. You are not able to search by all of the columns, just one, but you should be able to. For example, in the members table, you should be able to search by both the full name and the email address. You should show all entries that match either field.

  2. The icons for the events table for ICS used to be colored. When improving a component, keep as many of the old (useful) features as you can.

image

  1. Using grid is suboptimal styling here, as the display becomes weird for certain screen sizes:
    image

In the example above, you can see that there is more than enough space for both controls to be on the same line, but since you use grid the controls are forced to wrap. You should use floats instead.

  1. Fix all other comments mentioned in this review.

  2. Avoid using your own buttons when possible, and use Bulma buttons for style consistency. In this case, you can use is-small and something like is-light to replicate the button styles you have now.

image

frontend/components/common/Table.tsx Outdated Show resolved Hide resolved
frontend/components/ModelForm.tsx Outdated Show resolved Hide resolved
frontend/components/ModelForm.tsx Outdated Show resolved Hide resolved
@alnasir7 alnasir7 force-pushed the fix-table branch 2 times, most recently from 6be2a86 to f80636f Compare March 5, 2021 00:50
Copy link
Member

@ezwang ezwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might not want to delete the icon files. The fact that they were there before you made this PR gives a strong indication that some icon is still using those files.

Otherwise looks good to me! Haven't executed the code though, will let you know if anything comes up. Merge after Armaan has completed the AWS migration.

@alnasir7
Copy link
Contributor Author

alnasir7 commented Mar 5, 2021

You might not want to delete the icon files. The fact that they were there before you made this PR gives a strong indication that some icon is still using those files.

Otherwise looks good to me! Haven't executed the code though, will let you know if anything comes up. Merge after Armaan has completed the AWS migration.

You might not want to delete the icon files. The fact that they were there before you made this PR gives a strong indication that some icon is still using those files.

Otherwise looks good to me! Haven't executed the code though, will let you know if anything comes up. Merge after Armaan has completed the AWS migration.

I added the icons on the previous PR. They were not used before. In this PR I changed to something else so I removed them

@alnasir7 alnasir7 requested review from cphalen and esinx March 26, 2021 21:09
@alnasir7 alnasir7 changed the title small changes Fix table bugs Mar 26, 2021
Copy link
Member

@esinx esinx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some readability fixes can be really useful, and check for edge cases where some states are not within the expected range!

frontend/components/ClubEditPage/EventsCard.tsx Outdated Show resolved Hide resolved
frontend/components/ModelForm.tsx Outdated Show resolved Hide resolved
frontend/components/ModelForm.tsx Outdated Show resolved Hide resolved
frontend/components/common/Table.tsx Outdated Show resolved Hide resolved
<Icon name="chevron-down" />
<div onClick={() => handleColumnsSort(column.Header)}>
{titleize(column.render('Header'))}
<span style={{ marginLeft: '1rem' }}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to see which icons are being rendered in which conditions, so consider extracting this into a function that returns the icon name!

const iconNameForSortedState = (column): string => {
    if(column.isSorted){
        if(column.isSortedDesc) {
            return "triangle-down"
        }else{
            return "triangle-up"
        }
    }
    return "group-arrows"
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might still not be easy to do, in one of the cases I will be returning an empty string and not an icon.

frontend/components/common/Table.tsx Outdated Show resolved Hide resolved
</button>
<button
style={{ marginRight: '0.5rem' }}
onClick={() => nextPage()}
className="is-light is-small"
onClick={() => gotoPage(pageCount - 1)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can pageCount ever be 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think. CanPrevious is automatically set to disabled when we are at page 1, so I don't see how that might happen.

@alnasir7 alnasir7 removed the request for review from cphalen October 31, 2021 17:20
@alnasir7 alnasir7 requested a review from cphalen October 31, 2021 17:20
@rohangpta
Copy link
Member

@alnasir7 Do you mind walking me through this PR at some point? There seems to be a lot! "Table bugs" sounds pretty ominous too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants